package org.subside.HibernateJPA;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author : zhangbo
 * @data : 2024/6/1
 * @description :
 */
public class test2 {

    public static void main(String[] args) {
        LocalDate startDate = LocalDate.of(2024, 6, 1); // 活动开始日期
        LocalDate currentDate = startDate;
        List<LocalDate> weekDates = new ArrayList<>();
        // 假设我们想要展示4周的数据
        for (int i = 0; i < 4; i++) {
            // 添加当前周的开始日期
            weekDates.add(currentDate);
            // 计算当前周的结束日期
            LocalDate endDate = currentDate.plusDays(6);
            weekDates.add(endDate);
            // 输出当前周的日期范围
            System.out.println("Week " + (i + 1) + ": " + weekDates.get(0) + " to " + weekDates.get(1));
            // 准备下一周的开始日期
            currentDate = endDate.plusDays(1);
            weekDates.clear(); // 清空列表，为下一周准备
        }
    }
}

